<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Hello, Bootstrap Table!</title>
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/bootstrap-table.css">
    <script src="../js/jquery-3.4.1.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <script src="../js/bootstrap-table.min.js"></script>

    <style>
        .left {
            float: left;
        }
        .right {
            float: right;
        }
        .like {
            margin-right: 10px;
        }
        .item {
            margin-bottom: 20px;
        }
    </style>
</head>
<body>
<div class="item">
    <table
            data-toggle="table"
            data-url="../json/data3.json">
        <thead>
        <tr>
            <th data-field="github.name"
                data-formatter="operateFormatter"
                data-events="operateEvents">Bookmark 1</th>
        </tr>
        </thead>
    </table>
</div>

<script>
  window.operateEvents = {
    'click .like': function (e, value, row) {
      alert('You click like action, row: ' + JSON.stringify(row))
      console.log(row)
      console.log(e)
    },
    'click .remove': function (e, value, row) {
      alert('You click remove action, row: ' + JSON.stringify(row))
    }
  }
  function operateFormatter(value, row, index) {
    return [
      '<div class="left">',
      '<a href="https://github.com/wenzhixin/' + value + '" target="_blank">' + value + '</a>',
      '</div>',
      '<div class="right">',
      '<a class="like" href="javascript:void(0)" title="Like">',
      '<i class="fa fa-heart"></i>',
      '</a>  ',
      '<a class="remove" href="javascript:void(0)" title="Remove">',
      '<i class="fa fa-trash"></i>',
      '</a>',
      '</div>'
    ].join('')
  }
</script>
</body>
</html>
